package org.bilinc.gz001;

import javax.swing.*;
import java.awt.*;

public class YearCellEditor extends DefaultCellEditor {
    public YearCellEditor() {
        super(new JTextField());
    }

    public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected,
                                                 int row, int column) {
        JTextField editor = (JTextField) super.getTableCellEditorComponent(table, value, isSelected,
                row, column);
        if (table.isCellEditable(row, column)) {
            if (value != null) {
                if (!value.equals("")) {
                    editor.selectAll();
                }
            }
        }
        return editor;
    }
}